#include "ClassHashTable.h"
//necessary
#include "memory-tools.h"


//TODO testing
void initClassHT(PclassHashTable phashtable){
	*phashtable=NULL;
}

//TODO testing
PclassElement findClassInHashTable(PclassHashTable phashtable,const char* key){
	PclassHTCell result;
	HASH_FIND_STR(*phashtable,key,result);
	if (result==NULL){
		return NULL;
	}
	return result->class;
}

//TODO testing
void addClassInHashTable(PclassHashTable phashtable, PclassElement obj){
	PclassHTCell pcell=initClassHTCell(obj);
	HASH_ADD_KEYPTR(hh,*phashtable,pcell->key,strlen(pcell->key),pcell);
}

//TODO testing
void freeclassHT(PclassHashTable phashtable){
	PclassHTCell element;
	PclassHTCell tmp;

	HASH_ITER(hh,*phashtable,element,tmp){
		HASH_DEL(*phashtable,element);
		freeClassHTCell(element);
	}
}

void generateDOTClassHashTable(FILE* f,PclassHashTable phashtable,int* start){
	//TODO code here...
}
